package com.ego.item.mapper;

import com.ego.item.pojo.Brand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand>{
    @Insert("insert into tb_category_brand (category_id,brand_id) values (#{cid},#{bid})")
    void insertCategoryBrand(@Param("cid") Integer cid, @Param("bid") Long id);
    @Delete("delete from tb_category_brand where brand_id=#{bid}")
    void deleteCategoryBrand(@Param("bid")Long bid);
    @Select("select * from tb_brand where id in(select brand_id from tb_category_brand where category_id=#{cid})")
    List<Brand> findByCid(@Param("cid") Long cid);
}
